 package tools.packet;


import client.MapleCharacter;
import client.MapleClient;
import client.inventory.Item;
import handling.opcode.InteractionOpcode;
import handling.opcode.SendPacketOpcode;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import server.MerchItemPackage;
import server.shops.*;
import tools.Pair;
import tools.data.output.MaplePacketLittleEndianWriter;

import java.util.List;
import java.util.Map;



















 public class PlayerShopPacket {
/*  22 */   private static final Logger log = LogManager.getLogger();

   public static byte[] sendTitleBox(int message) {
/*  25 */     return sendTitleBox(message, 0, 0);
   }

   public static byte[] sendTitleBox(int message, int mapId, int ch) {
/*  29 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/*  31 */     mplew.writeShort(SendPacketOpcode.SEND_TITLE_BOX.getValue());
/*  32 */     mplew.write(message);
/*  33 */     switch (message) {




       case 8:
       case 16:
/*  40 */         mplew.writeInt(mapId);
/*  41 */         mplew.write(ch);
         break;
     }

/*  45 */     return mplew.getPacket();
   }

   public static byte[] sendPlayerBox(MapleCharacter chr) {
/*  49 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/*  51 */     mplew.writeShort(SendPacketOpcode.UPDATE_CHAR_BOX.getValue());
/*  52 */     mplew.writeInt(chr.getId());
/*  53 */     PacketHelper.addAnnounceBox(mplew, chr);

/*  55 */     return mplew.getPacket();
   }

   public static byte[] getHiredMerch(MapleCharacter chr, HiredMerchant merch, boolean firstTime) {
/*  59 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/*  61 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/*  62 */     mplew.write(InteractionOpcode.房间.getValue());
/*  63 */     mplew.write(6);
/*  64 */     mplew.write(merch.getMaxSize());
/*  65 */     mplew.writeShort((short)merch.getVisitorSlot(chr));
/*  66 */     mplew.writeInt(merch.getItemId());
/*  67 */     mplew.writeMapleAsciiString("雇佣商人");
/*  68 */     for (Pair<Byte, MapleCharacter> storechr : (Iterable<Pair<Byte, MapleCharacter>>)merch.getVisitors()) {
/*  69 */       mplew.write(((Byte)storechr.left).byteValue());
/*  70 */       PacketHelper.addCharLook(mplew, (MapleCharacter)storechr.right, true, ((MapleCharacter)storechr.right).isZeroSecondLook());
/*  71 */       mplew.writeMapleAsciiString(((MapleCharacter)storechr.right).getName());
/*  72 */       mplew.writeShort(((MapleCharacter)storechr.right).getJob());
     }
/*  74 */     mplew.write(-1);
/*  75 */     mplew.writeShort(merch.isOwner(chr) ? merch.getMessages().size() : 0);
/*  76 */     if (merch.isOwner(chr)) {
/*  77 */       for (int i = 0; i < merch.getMessages().size(); i++) {
/*  78 */         mplew.writeMapleAsciiString((String)((Pair)merch.getMessages().get(i)).getLeft());
/*  79 */         mplew.write(((Byte)((Pair)merch.getMessages().get(i)).getRight()).byteValue());
       }
     }
/*  82 */     mplew.writeMapleAsciiString(merch.getOwnerName());
/*  83 */     if (merch.isOwner(chr)) {




/*  88 */       mplew.writeInt(merch.getTimeLeft(firstTime));
/*  89 */       mplew.write(firstTime ? 1 : 0);
/*  90 */       mplew.write(merch.getBoughtItems().size());
/*  91 */       for (AbstractPlayerStore.BoughtItem SoldItem : merch.getBoughtItems()) {
/*  92 */         mplew.writeInt(SoldItem.id);
/*  93 */         mplew.writeShort(SoldItem.quantity);
/*  94 */         mplew.writeLong(SoldItem.totalPrice);
/*  95 */         mplew.writeMapleAsciiString(SoldItem.buyer);
       }
/*  97 */       mplew.writeLong(merch.getMeso());
     }
/*  99 */     mplew.writeInt(merch.getObjectId());
/* 100 */     mplew.writeMapleAsciiString(merch.getDescription());
/* 101 */     mplew.write(16);
/* 102 */     mplew.writeLong(merch.getMeso());
/* 103 */     mplew.write(merch.getItems().size());
/* 104 */     for (MaplePlayerShopItem item : merch.getItems()) {
/* 105 */       mplew.writeShort(item.bundles);
/* 106 */       mplew.writeShort(item.item.getQuantity());
/* 107 */       mplew.writeLong(item.price);
/* 108 */       PacketHelper.addItemInfo(mplew, item.item);
     }
/* 110 */     mplew.writeShort(0);

/* 112 */     return mplew.getPacket();
   }

   public static byte[] getPlayerStore(MapleCharacter chr, boolean firstTime) {
/* 116 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 118 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 119 */     IMaplePlayerShop ips = chr.getPlayerShop();
/* 120 */     mplew.write(InteractionOpcode.房间.getValue());
/* 121 */     switch (ips.getShopType()) {
       case 2:
/* 123 */         mplew.write(5);
/* 124 */         mplew.write(7);
         break;
       case 3:
/* 127 */         mplew.write(2);
/* 128 */         mplew.write(2);
         break;
       case 4:
/* 131 */         mplew.write(1);
/* 132 */         mplew.write(2);
         break;
     }
/* 135 */     mplew.writeShort((short)ips.getVisitorSlot(chr));
/* 136 */     PacketHelper.addCharLook(mplew, ((MaplePlayerShop)ips).getMCOwner(), false, ((MaplePlayerShop)ips).getMCOwner().isZeroSecondLook());
/* 137 */     mplew.writeMapleAsciiString(ips.getOwnerName());
/* 138 */     mplew.writeShort(((MaplePlayerShop)ips).getMCOwner().getJob());
/* 139 */     for (Pair<Byte, MapleCharacter> storechr : (Iterable<Pair<Byte, MapleCharacter>>)ips.getVisitors()) {
/* 140 */       mplew.write(((Byte)storechr.left).byteValue());
/* 141 */       PacketHelper.addCharLook(mplew, (MapleCharacter)storechr.right, false, ((MapleCharacter)storechr.right).isZeroSecondLook());
/* 142 */       mplew.writeMapleAsciiString(((MapleCharacter)storechr.right).getName());
/* 143 */       mplew.writeShort(((MapleCharacter)storechr.right).getJob());
     }
/* 145 */     mplew.write(255);
/* 146 */     mplew.writeInt(0);
/* 147 */     mplew.writeMapleAsciiString(ips.getDescription());
/* 148 */     mplew.write(24);
/* 149 */     mplew.write(ips.getItems().size());
/* 150 */     for (MaplePlayerShopItem item : ips.getItems()) {
/* 151 */       mplew.writeShort(item.bundles);
/* 152 */       mplew.writeShort(item.item.getQuantity());
/* 153 */       mplew.writeLong(item.price);
/* 154 */       PacketHelper.addItemInfo(mplew, item.item);
     }
/* 156 */     mplew.writeShort(0);
/* 157 */     return mplew.getPacket();
   }




   public static byte[] playerInterChat(String message, int slot, String name) {
/* 164 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 166 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 167 */     mplew.write(InteractionOpcode.聊天.getValue());
/* 168 */     mplew.write(InteractionOpcode.聊天事件.getValue());
/* 169 */     mplew.write(slot);
/* 170 */     mplew.writeMapleAsciiString(message);
/* 171 */     mplew.writeInt(0);
/* 172 */     mplew.writeMapleAsciiString(name);
/* 173 */     mplew.writeMapleAsciiString(message);
/* 174 */     mplew.writeInt(0);
/* 175 */     mplew.writeInt(0);
/* 176 */     mplew.write(0);
/* 177 */     mplew.writeInt(0);
/* 178 */     return mplew.getPacket();
   }




   public static byte[] shopErrorMessage(int error, int type) {
/* 185 */     return shopErrorMessage(false, error, type);
   }

   public static byte[] shopErrorMessage(boolean room, int error, int type) {
/* 189 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/* 190 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 192 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 193 */     mplew.write(room ? InteractionOpcode.房间.getValue() : InteractionOpcode.退出.getValue());
/* 194 */     mplew.write(type);
/* 195 */     mplew.write(error);

/* 197 */     return mplew.getPacket();
   }





   public static byte[] spawnHiredMerchant(AbstractPlayerStore hm) {
/* 205 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 207 */     mplew.writeShort(SendPacketOpcode.SPAWN_HIRED_MERCHANT.getValue());
/* 208 */     mplew.writeInt(hm.getOwnerId());
/* 209 */     mplew.writeInt(hm.getItemId());
/* 210 */     mplew.writePos(hm.getTruePosition());
/* 211 */     mplew.writeShort((hm instanceof HiredFisher) ? ((HiredFisher)hm).getFh() : 0);
/* 212 */     mplew.writeMapleAsciiString(hm.getOwnerName());
/* 213 */     PacketHelper.addInteraction(mplew, (IMaplePlayerShop)hm);

/* 215 */     return mplew.getPacket();
   }




   public static byte[] destroyHiredMerchant(int id) {
/* 222 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 224 */     mplew.writeShort(SendPacketOpcode.DESTROY_HIRED_MERCHANT.getValue());
/* 225 */     mplew.writeInt(id);

/* 227 */     return mplew.getPacket();
   }




   public static byte[] shopItemUpdate(IMaplePlayerShop shop) {
/* 234 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 236 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 237 */     mplew.write(InteractionOpcode.雇佣商店_更新信息.getValue());
/* 238 */     if (shop.getShopType() == 1) {
/* 239 */       mplew.writeLong(shop.getMeso());
     }
/* 241 */     mplew.write(shop.getItems().size());
/* 242 */     for (MaplePlayerShopItem item : shop.getItems()) {
/* 243 */       mplew.writeShort(item.bundles);
/* 244 */       mplew.writeShort(item.item.getQuantity());
/* 245 */       mplew.writeLong(item.price);
/* 246 */       PacketHelper.addItemInfo(mplew, item.item);
     }
/* 248 */     mplew.writeShort(0);

/* 250 */     return mplew.getPacket();
   }




   public static byte[] playerInterVisitorAdd(MapleCharacter chr, int slot) {
/* 257 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 259 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 260 */     mplew.write(InteractionOpcode.访问.getValue());
/* 261 */     mplew.write(slot);
/* 262 */     PacketHelper.addCharLook(mplew, chr, false, chr.isZeroSecondLook());
/* 263 */     mplew.writeMapleAsciiString(chr.getName());
/* 264 */     mplew.writeShort(chr.getJob());

/* 266 */     return mplew.getPacket();
   }




   public static byte[] playerInterVisitorLeave(byte slot) {
/* 273 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/* 274 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 276 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 277 */     mplew.write(InteractionOpcode.退出.getValue());
/* 278 */     mplew.write(slot);

/* 280 */     return mplew.getPacket();
   }




   public static byte[] Merchant_Buy_Error(byte message) {
/* 287 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 289 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());




/* 294 */     mplew.write(InteractionOpcode.雇佣商店_错误提示.getValue());















/* 310 */     mplew.write(message);

/* 312 */     return mplew.getPacket();
   }






   public static byte[] updateHiredMerchant(AbstractPlayerStore shop) {
/* 321 */     return updateHiredMerchant(shop, true);
   }

   public static byte[] updateHiredMerchant(AbstractPlayerStore shop, boolean update) {
/* 325 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 327 */     mplew.writeShort(update ? SendPacketOpcode.UPDATE_HIRED_MERCHANT.getValue() : SendPacketOpcode.CHANGE_HIRED_MERCHANT_NAME.getValue());
/* 328 */     mplew.writeInt(shop.getOwnerId());
/* 329 */     PacketHelper.addInteraction(mplew, (IMaplePlayerShop)shop);

/* 331 */     return mplew.getPacket();
   }




   public static byte[] hiredMerchantOwnerLeave() {
/* 338 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 340 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 341 */     mplew.write(InteractionOpcode.雇佣商店_关闭完成.getValue());
/* 342 */     mplew.write(0);

/* 344 */     return mplew.getPacket();
   }




   public static byte[] merchItem_Message(byte op) {
/* 351 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();








/* 360 */     mplew.writeShort(SendPacketOpcode.MERCH_ITEM_MSG.getValue());
/* 361 */     mplew.write(op);

/* 363 */     return mplew.getPacket();
   }

   public static byte[] merchItemStore(byte op) {
/* 367 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
/* 368 */     mplew.writeShort(SendPacketOpcode.MERCH_ITEM_STORE.getValue());



/* 372 */     mplew.write(op);
/* 373 */     switch (op)
     { case 43:
/* 375 */         mplew.writeInt(0);
/* 376 */         mplew.writeLong(0L);





/* 382 */         return mplew.getPacket(); }  mplew.write(0); return mplew.getPacket();
   }




   public static byte[] merchItemStore(int mapId, int ch) {
/* 389 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 391 */     mplew.writeShort(SendPacketOpcode.MERCH_ITEM_STORE.getValue());




/* 396 */     mplew.write(InteractionOpcode.SHOW_MERCH_ITEM_STOR.getValue());
/* 397 */     mplew.writeInt(9030000);
/* 398 */     mplew.writeInt(mapId);
/* 399 */     mplew.write((mapId != 999999999) ? ch : 0);

/* 401 */     return mplew.getPacket();
   }

   public static byte[] merchItemStore_ItemData(MerchItemPackage pack) {
/* 405 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 407 */     mplew.writeShort(SendPacketOpcode.MERCH_ITEM_STORE.getValue());




/* 412 */     mplew.write(InteractionOpcode.MERCH_ITEM_STOR.getValue());
/* 413 */     mplew.writeInt(9030000);
/* 414 */     mplew.writeInt(32272);
/* 415 */     mplew.writeZeroBytes(5);
/* 416 */     mplew.writeLong(pack.getMesos());
/* 417 */     mplew.write(0);
/* 418 */     mplew.write(pack.getItems().size());
/* 419 */     for (Item item : pack.getItems()) {
/* 420 */       PacketHelper.addItemInfo(mplew, item);
     }
/* 422 */     mplew.writeZeroBytes(3);

/* 424 */     return mplew.getPacket();
   }

   public static byte[] openMiniGameBox(MapleClient c, MapleMiniGame minigame) {
/* 428 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
/* 429 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 430 */     mplew.write(InteractionOpcode.房间.getValue());
/* 431 */     mplew.write(minigame.getGameType());
/* 432 */     mplew.write(minigame.getMaxSize());
/* 433 */     mplew.writeShort((short)minigame.getVisitorSlot(c.getPlayer()));
/* 434 */     PacketHelper.addCharLook(mplew, minigame.getMCOwner(), false, false);
/* 435 */     mplew.writeMapleAsciiString(minigame.getOwnerName());
/* 436 */     mplew.writeShort(minigame.getMCOwner().getJob());
/* 437 */     for (Pair<Byte, MapleCharacter> visitorz : (Iterable<Pair<Byte, MapleCharacter>>)minigame.getVisitors()) {
/* 438 */       mplew.write(((Byte)visitorz.getLeft()).byteValue());
/* 439 */       PacketHelper.addCharLook(mplew, (MapleCharacter)visitorz.getRight(), false, false);
/* 440 */       mplew.writeMapleAsciiString(((MapleCharacter)visitorz.getRight()).getName());
/* 441 */       mplew.writeShort(((MapleCharacter)visitorz.getRight()).getJob());
     }
/* 443 */     mplew.write(-1);
/* 444 */     mplew.write(0);
/* 445 */     addGameInfo(mplew, minigame.getMCOwner(), minigame);
/* 446 */     for (Pair<Byte, MapleCharacter> visitorz : (Iterable<Pair<Byte, MapleCharacter>>)minigame.getVisitors()) {
/* 447 */       mplew.write(((Byte)visitorz.getLeft()).byteValue());
/* 448 */       addGameInfo(mplew, (MapleCharacter)visitorz.getRight(), minigame);
     }
/* 450 */     mplew.write(-1);
/* 451 */     mplew.writeMapleAsciiString(minigame.getDescription());
/* 452 */     mplew.writeShort(minigame.getPieceType());
/* 453 */     return mplew.getPacket();
   }




   public static byte[] getMiniGameReady(boolean ready) {
/* 460 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
/* 461 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 462 */     mplew.write(ready ? InteractionOpcode.准备开始.getValue() : InteractionOpcode.准备就绪.getValue());
/* 463 */     return mplew.getPacket();
   }

   public static byte[] getMiniGameExitAfter(boolean ready) {
/* 467 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
/* 468 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 469 */     mplew.write(ready ? InteractionOpcode.退出游戏.getValue() : InteractionOpcode.取消退出.getValue());
/* 470 */     return mplew.getPacket();
   }

   public static byte[] getMiniGameStart(int loser) {
/* 474 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
/* 475 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 476 */     mplew.write(InteractionOpcode.开始游戏.getValue());
/* 477 */     mplew.write((loser == 1) ? 0 : 1);
/* 478 */     return mplew.getPacket();
   }

   public static byte[] getMiniGameSkip(int slot) {
/* 482 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
/* 483 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 484 */     mplew.write(InteractionOpcode.SKIP.getValue());

/* 486 */     mplew.write(slot);
/* 487 */     return mplew.getPacket();
   }

   public static byte[] getMiniGameRequestTie() {
/* 491 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
/* 492 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 493 */     mplew.write(InteractionOpcode.请求平局.getValue());
/* 494 */     return mplew.getPacket();
   }

   public static byte[] getMiniGameDenyTie() {
/* 498 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
/* 499 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 500 */     mplew.write(InteractionOpcode.应答平局.getValue());
/* 501 */     return mplew.getPacket();
   }

   public static byte[] getMiniGameFull() {
/* 505 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
/* 506 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 507 */     mplew.writeShort(InteractionOpcode.房间.getValue());
/* 508 */     mplew.write(2);
/* 509 */     return mplew.getPacket();
   }

   public static byte[] getMiniGameMoveOmok(int move1, int move2, int move3) {
/* 513 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
/* 514 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 515 */     mplew.write(InteractionOpcode.移动棋子.getValue());
/* 516 */     mplew.writeInt(move1);
/* 517 */     mplew.writeInt(move2);
/* 518 */     mplew.write(move3);
/* 519 */     return mplew.getPacket();
   }

   public static byte[] getMiniGameNewVisitor(MapleCharacter c, int slot, MapleMiniGame game) {
/* 523 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
/* 524 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 525 */     mplew.write(InteractionOpcode.访问.getValue());
/* 526 */     mplew.write(slot);
/* 527 */     PacketHelper.addCharLook(mplew, c, false, false);
/* 528 */     mplew.writeMapleAsciiString(c.getName());
/* 529 */     mplew.writeShort(c.getJob());
/* 530 */     addGameInfo(mplew, c, game);
/* 531 */     return mplew.getPacket();
   }

   public static void addGameInfo(MaplePacketLittleEndianWriter mplew, MapleCharacter chr, MapleMiniGame game) {
/* 535 */     mplew.writeInt(game.getGameType());
/* 536 */     mplew.writeInt(game.getWins(chr));
/* 537 */     mplew.writeInt(game.getTies(chr));
/* 538 */     mplew.writeInt(game.getLosses(chr));
/* 539 */     mplew.writeInt(game.getScore(chr));
   }

   public static byte[] getMiniGameClose(byte number) {
/* 543 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
/* 544 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 545 */     mplew.write(InteractionOpcode.退出.getValue());
/* 546 */     mplew.write(1);
/* 547 */     mplew.write(number);
/* 548 */     return mplew.getPacket();
   }

   public static byte[] getMatchCardStart(MapleMiniGame game, int loser) {
/* 552 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
/* 553 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 554 */     mplew.write(InteractionOpcode.开始游戏.getValue());
/* 555 */     mplew.write((loser == 1) ? 0 : 1);
/* 556 */     int times = (game.getPieceType() == 1) ? 20 : ((game.getPieceType() == 2) ? 30 : 12);
/* 557 */     mplew.write(times);
/* 558 */     for (int i = 1; i <= times; i++) {
/* 559 */       mplew.writeInt(game.getCardId(i));
     }
/* 561 */     return mplew.getPacket();
   }

   public static byte[] getMatchCardSelect(int turn, int slot, int firstslot, int type) {
/* 565 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
/* 566 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 567 */     mplew.write(InteractionOpcode.选择卡片.getValue());
/* 568 */     mplew.write(turn);
/* 569 */     mplew.write(slot);
/* 570 */     if (turn == 0) {
/* 571 */       mplew.write(firstslot);
/* 572 */       mplew.write(type);
     }
/* 574 */     return mplew.getPacket();
   }

   public static byte[] getMiniGameResult(MapleMiniGame game, int type, int x) {
/* 578 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
/* 579 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 580 */     mplew.write(InteractionOpcode.GAME_RESULT.getValue());
/* 581 */     mplew.write(type);
/* 582 */     game.setPoints(x, type);
/* 583 */     if (type != 0) {
/* 584 */       game.setPoints((x == 1) ? 0 : 1, (type == 2) ? 0 : 1);
     }
/* 586 */     if (type != 1) {
/* 587 */       if (type == 0) {
/* 588 */         mplew.write((x == 1) ? 0 : 1);
       } else {
/* 590 */         mplew.write(x);
       }
     }
/* 593 */     addGameInfo(mplew, game.getMCOwner(), game);
/* 594 */     for (Pair<Byte, MapleCharacter> visitorz : (Iterable<Pair<Byte, MapleCharacter>>)game.getVisitors()) {
/* 595 */       addGameInfo(mplew, (MapleCharacter)visitorz.right, game);
     }

/* 598 */     return mplew.getPacket();
   }




   public static byte[] MerchantVisitorView(Map<String, AbstractPlayerStore.VisitorInfo> visitor) {
/* 605 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 607 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 608 */     mplew.write(InteractionOpcode.雇佣商店_查看访问名单.getValue());
/* 609 */     mplew.writeShort(visitor.size());
/* 610 */     for (Map.Entry<String, AbstractPlayerStore.VisitorInfo> ret : visitor.entrySet()) {
/* 611 */       mplew.writeMapleAsciiString(ret.getKey());
/* 612 */       mplew.writeInt(((AbstractPlayerStore.VisitorInfo)ret.getValue()).getInTime());
     }

/* 615 */     return mplew.getPacket();
   }




   public static byte[] MerchantBlackListView(List<String> blackList) {
/* 622 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 624 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 625 */     mplew.write(InteractionOpcode.雇佣商店_查看黑名单.getValue());
/* 626 */     mplew.writeShort(blackList.size());
/* 627 */     for (String visit : blackList) {
/* 628 */       mplew.writeMapleAsciiString(visit);
     }
/* 630 */     return mplew.getPacket();
   }

   public static byte[] FishNotice() {
/* 634 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 636 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 637 */     mplew.write(InteractionOpcode.FISH_NOTICE.getValue());
/* 638 */     mplew.write(75);
/* 639 */     mplew.write(24);

/* 641 */     return mplew.getPacket();
   }

   public static byte[] FishExit() {
/* 645 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 647 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 648 */     mplew.write(InteractionOpcode.退出.getValue());
/* 649 */     mplew.write(0);
/* 650 */     mplew.write(17);

/* 652 */     return mplew.getPacket();
   }
 }


/* Location:              C:\PGX\Server.jar!\tools\packet\PlayerShopPacket.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */